package com.yanqu.road.logic.sort;

import com.yanqu.road.entity.activity.unionwar.cross.UnionWarPatronsData;

import java.util.Comparator;

/**
 * 商会战门客出战排序
 */
public class UnionWarPatronsSort implements Comparator<UnionWarPatronsData> {
    @Override
    public int compare(UnionWarPatronsData o1, UnionWarPatronsData o2) {
        int result = o1.getUnionPosition() - o2.getUnionPosition();
        if (result != 0) {
            return result;
        }
        long time = o1.getModifyTime() - o2.getModifyTime();
        result = time > 0 ? 1 : (time == 0 ? 0 : -1);
        if(0 != result){
            return result;
        }
        result = o1.getAmbush() - o2.getAmbush();
        if(result > 0){
            return 1;
        }else if(result < 0){
            return -1;
        }else {
            return 0;
        }
    }
}
